package com.xxl.job.executor.controller;


import com.xxl.job.executor.config.listener.LearnMyEvent;
import com.xxl.job.executor.config.listener.LearnMyPublisher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhouhaicheng
 * @since 2022-01-04
 */
@Controller
@RequestMapping("/types")
public class TypesController {

  @Resource
  LearnMyPublisher learnMyPublisher;

  @ResponseBody
  @GetMapping("/publish")
  public Object publish() {
    learnMyPublisher.publish(new LearnMyEvent("学习事件发布啦！"));
    return "success";
  }
}
